#ifndef DEF_PARSER
#define DEF_PARSER

#include <iostream>
#include <string>

#include <fstream>
#include <sstream>
#include <vector>

#include "StringUtils.hpp"
#include "StringUtils.hpp"

#include "../common/TachePeriodique.hpp"
#include "../common/TacheAperiodique.hpp"
#include "../common/Tache.hpp"

class Parser
{
public:
	Parser(std::string fileUrl);

	std::vector<TacheAperiodique> getTachesAperiodiques(){return parsedAperiodicTasks;};
	std::vector<TachePeriodique> getTachesPerdiodiques(){return parsedPeriodicTasks;};

	void parseTasks();
private:
	std::vector <std::string> split (std::string str, char delim);    
	std::ifstream *file;

	void parseAperiodicTask();
	void parsePeriodicTask();

	void nextToken();
	std::string token;
	std::vector<std::string> elements;
	std::vector<std::string> explode( const std::string &delimiter, const std::string &str);

	std::vector<TacheAperiodique> parsedAperiodicTasks;
	std::vector<TachePeriodique> parsedPeriodicTasks;
};


#endif /* DEF_PARSER */